package org.hxyjs.entity;

import org.hxyjs.vo.MailUser;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author 
 */
public class User extends MailUser implements Serializable,Account {
    private String uno;

    private String uname;

    private String uid;

    public User() {

    }

    private String upwd;

    private String ustate;

    private String uaddr;

    private String uimg;

    private String udesc;

    private String uemail;

    private String uphone;

    private List<OrderForm> orderForms;

    public List<OrderForm> getOrderForms() {
        return orderForms;
    }

    //shiro 准备 登录用的 成员变量和方法
    String salt;//加密用的盐
    Integer isDelete;
    Date createDate;
    Boolean locked = Boolean.FALSE;//是否锁定

    List<AccountRole> accountRoles;
    @Override
    public String getAccountid() {
        return uno;
    }
    @Override
    public String getAccountname() {
        return uname;
    }

    @Override
    public String getPassword() {
        return upwd;
    }
    @Override
    public String getSalt() {
        return salt;
    }
    public void setSalt(String salt) {
        this.salt = salt;
    }
    @Override
    public Integer getIsDelete() {
        return isDelete;
    }


    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

    @Override
    public Date getCreateDate() {
        return createDate;
    }


    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    @Override
    public Boolean getLocked() {
        return locked;
    }


    public void setLocked(Boolean locked) {
        this.locked = locked;
    }

    @Override
    public List<AccountRole> getAccountRoles() {
        return accountRoles;
    }


    public void setAccountRoles(List<AccountRole> accountRoles) {
        this.accountRoles = accountRoles;
    }

    public String getCredentialsSalt()
    {
        return getAccountname() + salt;
    }
//结束    shiro 准备 登录用的 成员变量和方法





    public void setOrderForms(List<OrderForm> orderForms) {
        this.orderForms = orderForms;
    }

    private static final long serialVersionUID = 1L;

    public String getUno() {
        return uno;
    }

    public void setUno(String uno) {
        this.uno = uno;
    }

    public String getUname() {
        return uname;
    }

    public void setUname(String uname) {
        this.uname = uname;
        this.mailName = uname;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getUpwd() {
        return upwd;
    }

    public void setUpwd(String upwd) {
        this.upwd = upwd;
    }

    public String getUstate() {
        return ustate;
    }

    public void setUstate(String ustate) {
        this.ustate = ustate;
    }

    public String getUaddr() {
        return uaddr;
    }

    public void setUaddr(String uaddr) {
        this.uaddr = uaddr;
    }

    public String getUimg() {
        return uimg;
    }

    public void setUimg(String uimg) {
        this.uimg = uimg;
    }

    public String getUdesc() {
        return udesc;
    }

    public void setUdesc(String udesc) {
        this.udesc = udesc;
    }

    public String getUemail() {
        return uemail;
    }

    public void setUemail(String uemail) {
        this.uemail = uemail;
        this.mailAddress = uemail;
    }

    public String getUphone() {
        return uphone;
    }

    public void setUphone(String uphone) {
        this.uphone = uphone;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        User other = (User) that;
        return (this.getUno() == null ? other.getUno() == null : this.getUno().equals(other.getUno()))
            && (this.getUname() == null ? other.getUname() == null : this.getUname().equals(other.getUname()))
            && (this.getUid() == null ? other.getUid() == null : this.getUid().equals(other.getUid()))
            && (this.getUpwd() == null ? other.getUpwd() == null : this.getUpwd().equals(other.getUpwd()))
            && (this.getUstate() == null ? other.getUstate() == null : this.getUstate().equals(other.getUstate()))
            && (this.getUaddr() == null ? other.getUaddr() == null : this.getUaddr().equals(other.getUaddr()))
            && (this.getUimg() == null ? other.getUimg() == null : this.getUimg().equals(other.getUimg()))
            && (this.getUdesc() == null ? other.getUdesc() == null : this.getUdesc().equals(other.getUdesc()))
            && (this.getUemail() == null ? other.getUemail() == null : this.getUemail().equals(other.getUemail()))
            && (this.getUphone() == null ? other.getUphone() == null : this.getUphone().equals(other.getUphone()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getUno() == null) ? 0 : getUno().hashCode());
        result = prime * result + ((getUname() == null) ? 0 : getUname().hashCode());
        result = prime * result + ((getUid() == null) ? 0 : getUid().hashCode());
        result = prime * result + ((getUpwd() == null) ? 0 : getUpwd().hashCode());
        result = prime * result + ((getUstate() == null) ? 0 : getUstate().hashCode());
        result = prime * result + ((getUaddr() == null) ? 0 : getUaddr().hashCode());
        result = prime * result + ((getUimg() == null) ? 0 : getUimg().hashCode());
        result = prime * result + ((getUdesc() == null) ? 0 : getUdesc().hashCode());
        result = prime * result + ((getUemail() == null) ? 0 : getUemail().hashCode());
        result = prime * result + ((getUphone() == null) ? 0 : getUphone().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", uno=").append(uno);
        sb.append(", uname=").append(uname);
        sb.append(", uid=").append(uid);
        sb.append(", upwd=").append(upwd);
        sb.append(", ustate=").append(ustate);
        sb.append(", uaddr=").append(uaddr);
        sb.append(", uimg=").append(uimg);
        sb.append(", udesc=").append(udesc);
        sb.append(", uemail=").append(uemail);
        sb.append(", uphone=").append(uphone);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}